//
//  MessageDetailTableViewCell.m
//  LubanWork
//
//  Created by xiaohao on 2020/1/2.
//  Copyright © 2020 xiaohao. All rights reserved.
//

#import "MessageDetailTableViewCell.h"
@implementation MessageDetailTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setFrame];
    }
    return self;
}
-(void)setFrame{
    self.backgroundColor = kColorFromRGB(248, 249, 255);
    [self addSubview:self.headerImageView];
    [self addSubview:self.messageView];
    [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(KSCHEIGHT(20));
        make.left.mas_offset(kSCRATIO(25));
        make.width.height.mas_offset(kSCRATIO(40));
    }];
    [self.messageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(KSCHEIGHT(20));
        make.width.mas_offset(kSCRATIO(190));
        make.height.mas_offset(KSCHEIGHT(200));
        make.left.mas_equalTo(self.headerImageView.mas_right).mas_offset(kSCRATIO(9));
    }];
    
}

-(UIImageView *)headerImageView{
    if (!_headerImageView) {
        _headerImageView = [[UIImageView alloc] init];
        ViewRadius(_headerImageView, kSCRATIO(20));
        _headerImageView.backgroundColor = [UIColor redColor];
    }
    return _headerImageView;
}
-(MessageView *)messageView{
    if (!_messageView) {
        _messageView = [[MessageView alloc] init];
        _messageView.backgroundColor = ColorWhite;
        ViewRadius(_messageView, 5);
    }
    return _messageView;
}
@end

@implementation MessageView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setFrame];
    }
    return self;
}
-(void)setFrame{
    
    self.width = kSCRATIO(190);
    self.height = KSCHEIGHT(205);
    [self addSubview:self.jobTitleLabel];
    [self addSubview:self.jobNameLabel];
    [self addSubview:self.jobPriceLabel];
    [self addSubview:self.signLab];
    [self addSubview:self.jodDetailLabel];
    [self addSubview:self.jobButton];
    
    [self.jobTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.left.mas_offset(kSCRATIO(20));
        make.top.mas_offset(KSCHEIGHT(15));
    }];
    [self.jobNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(kSCRATIO(20));

        make.left.mas_equalTo(self.jobTitleLabel.mas_left); make.top.mas_equalTo(self.jobTitleLabel.mas_bottom).mas_offset(KSCHEIGHT(25));
    }];
    [self.jobPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//       make.left.mas_equalTo(self.jobTitleLabel.mas_left);
        make.left.mas_offset(kSCRATIO(20));
        make.top.mas_equalTo(self.jobNameLabel.mas_bottom).mas_offset(KSCHEIGHT(10));
        make.left.mas_offset(kSCRATIO(19));
    }];
    [self.signLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.jobPriceLabel.mas_right).mas_offset(0);
        make.bottom.mas_equalTo(self.jobPriceLabel.mas_bottom).mas_offset(0);
    }];
    [self.jodDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//      make.left.mas_equalTo(self.jobTitleLabel.mas_left);
        make.left.mas_offset(kSCRATIO(20));
        make.top.mas_equalTo(self.jobPriceLabel.mas_bottom).mas_offset(KSCHEIGHT(10));
       make.left.mas_offset(kSCRATIO(22));
    }];
    [self.jobButton mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(self.jobTitleLabel.mas_left);
        make.left.mas_offset(kSCRATIO(20));
        make.top.mas_equalTo(self.jodDetailLabel.mas_bottom).mas_offset(KSCHEIGHT(35));
        make.width.mas_offset(kSCRATIO(150));
        make.centerX.mas_equalTo(self);
    }];
}
-(UILabel *)jobTitleLabel{
    if (!_jobTitleLabel) {
        _jobTitleLabel = [UILabel CreatLabeltext:@"精选热门职位,感谢您的参与" Font:MarkFont(11) Textcolor:kColorFromRGBHex(0x777777) textAlignment:NSTextAlignmentLeft];
    }
    return _jobTitleLabel;
}
-(UILabel *)jobNameLabel{
    if (!_jobNameLabel) {
        _jobNameLabel = [UILabel CreatLabeltext:@"职位名称职位名称" Font:MarkFont(15) Textcolor:kColorFromRGBHex(0x333333) textAlignment:NSTextAlignmentLeft];
    }
    return _jobNameLabel;
}
-(UILabel *)jobPriceLabel{
    if (!_jobPriceLabel) {
        _jobPriceLabel = [UILabel CreatLabeltext:@"88元/天" Font:MarkFont(18) Textcolor:ColorMain textAlignment:NSTextAlignmentLeft];
    }
    return _jobPriceLabel;
}

-(UILabel *)signLab{
    if (!_signLab) {
        _signLab = [UILabel CreatLabeltext:@"元/天" Font:kFONT(12) Textcolor:ColorMain textAlignment:NSTextAlignmentLeft];
    }
    return _signLab;
}
-(UILabel *)jodDetailLabel{
    if (!_jodDetailLabel) {
        _jodDetailLabel = [UILabel CreatLabeltext:@"日结丨长期丨男女不限" Font:MarkFont(12) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
    }
    return _jodDetailLabel;
}
//copyWeChat
-(UIButton *)jobButton{
    if (!_jobButton) {
        _jobButton = [UIButton CreatButtontext:@"" image:[UIImage imageNamed:@"copyWeChat"] Font:nil Textcolor:nil];
//        [_jobButton addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
    }
    return _jobButton;
}
//-(void)click{
//    
//}


@end
